package com.daxia.bumall.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.daxia.bumall.basemodel.CoreUser;

/**
 * User
 */
@Entity
@Table(name = "user")
public class User extends CoreUser {
	public User() {
	}
	/**
	 * id
	 */
	@Id
	@GeneratedValue
	@Column(name = "id")
	private Long id;

	@ManyToOne
	@JoinColumn(name = "parent_user_id")
	private User parent;
	
	/**
	 * 用户名
	 */
	@Column(name = "username")
	private String username;
	/**
	 * 电话
	 */
	@Column(name = "mobile")
	private String mobile;
	/**
	 * 密码
	 */
	@Column(name = "password")
	private String password;
	/**
	 * 用户类型
	 */
	@Column(name = "type")
	private Integer type;
	/**
	 * 用户头像
	 */
	@Column(name = "headImage")
	private String headImage;
	/**
	 * 性别,0
	 */
	@Column(name = "sex")
	private Integer sex;
	
	@ManyToOne()
	@JoinColumn(name = "department_id")
	private Department department;
	/**
	 * 省
	 */
	@ManyToOne()
	@JoinColumn(name = "province_id")
	private Province province;
	/**
	 * 城市
	 */
	@ManyToOne()
	@JoinColumn(name = "city_id")
	private City city;
	/**
	 * 地区
	 */
	@ManyToOne()
	@JoinColumn(name = "district_id")
	private District district;
	/**
	 * 地址
	 */
	@Column(name = "address")
	private String address;
	/**
	 * 昵称
	 */
	@Column(name = "nickName")
	private String nickName;
	/**
	 * 创建时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name = "createtime")
	private Date createtime;
	/**
	 * 生日
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "birthday")
	private Date birthday;

	private String realName;

	/**
	 * 纬度
	 */
	@Column(name = "latitude")
	private Double latitude;
	/**
	 * 经度
	 */
	@Column(name = "longitude")
	private Double longitude;
	/**
	 * unionid
	 */
	@Column(name = "unionid")
	private String unionid;
	/**
	 * 最后更新GPS时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "lastGpsUpdatedTime")
	private Date lastGpsUpdatedTime;

	/**
	 * 最后更新职业时间
	 */
	private Date lastUpdateAddressTime;

	/**
	 * 最后更新地址时间
	 */
	private Date lastUpdateCircleTime;

	/**
	 * openid
	 */
	@Column(name = "openid")
	private String openid;

	/**
	 * 微信
	 */
	@Column(name = "weixin")
	private String weixin;
	/**
	 * 联系人
	 */
	@Column(name = "contactName")
	private String contactName;
	/**
	 * 种子用户状态
	 */
	@Column(name = "seedStatus")
	private Integer seedStatus;
	/**
	 * 小区
	 */
	@Column(name = "communityName")
	private String communityName;
	
	
	@OneToMany(mappedBy = "user")
	private List<Designer> designers = new ArrayList<Designer>();
	
	@Column(name = "age")
	private Integer age;
	
	/**
	 * 个性签名
	 */
	@Column(name = "stateMessage")
	private String stateMessage;
	
	/**
	 * 价格因子
	 */
	private Double priceFactor;
	
	/**
	 * 推荐人
	 */
	@ManyToOne()
	@JoinColumn(name = "recUser_id")
	private User recUser;
	
	/**
	 * 序号
	 */
	@Column(name = "seq")
	private String seq;
	
	/**
	 * qq
	 */
	@Column(name = "QQ")
	private String QQ;
	
	
	/**
	 * 最后登录时间
	 */
	@Column(name="lastLoginTime")
	private Date lastLoginTime;
	
	/**
	 * sesionID
	 */
	private String sessionID;
	
	private String ogSessionId; 
	private boolean deleted;
	
	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	public User(Long id) {
		this.id = id;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public String getHeadImage() {
		return headImage;
	}

	public void setHeadImage(String headImage) {
		this.headImage = headImage;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public Province getProvince() {
		return province;
	}

	public void setProvince(Province province) {
		this.province = province;
	}

	public City getCity() {
		return city;
	}

	public void setCity(City city) {
		this.city = city;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public Double getLatitude() {
		return latitude;
	}

	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}

	public Double getLongitude() {
		return longitude;
	}

	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}

	public String getUnionid() {
		return unionid;
	}

	public void setUnionid(String unionid) {
		this.unionid = unionid;
	}

	public Date getLastGpsUpdatedTime() {
		return lastGpsUpdatedTime;
	}

	public void setLastGpsUpdatedTime(Date lastGpsUpdatedTime) {
		this.lastGpsUpdatedTime = lastGpsUpdatedTime;
	}

	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	public District getDistrict() {
		return district;
	}

	public void setDistrict(District district) {
		this.district = district;
	}

	public Date getLastUpdateAddressTime() {
		return lastUpdateAddressTime;
	}

	public void setLastUpdateAddressTime(Date lastUpdateAddressTime) {
		this.lastUpdateAddressTime = lastUpdateAddressTime;
	}

	public Date getLastUpdateCircleTime() {
		return lastUpdateCircleTime;
	}

	public void setLastUpdateCircleTime(Date lastUpdateCircleTime) {
		this.lastUpdateCircleTime = lastUpdateCircleTime;
	}

	public String getWeixin() {
		return weixin;
	}

	public void setWeixin(String weixin) {
		this.weixin = weixin;
	}

	public User getParent() {
		return parent;
	}

	public void setParent(User parent) {
		this.parent = parent;
	}

	public String getContactName() {
		return contactName;
	}

	public void setContactName(String contactName) {
		this.contactName = contactName;
	}

	public Integer getSeedStatus() {
		return seedStatus;
	}

	public void setSeedStatus(Integer seedStatus) {
		this.seedStatus = seedStatus;
	}

	public String getCommunityName() {
		return communityName;
	}

	public void setCommunityName(String communityName) {
		this.communityName = communityName;
	}

	public List<Designer> getDesigners() {
		return designers;
	}

	public void setDesigners(List<Designer> designers) {
		this.designers = designers;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public String getStateMessage() {
		return stateMessage;
	}

	public void setStateMessage(String stateMessage) {
		this.stateMessage = stateMessage;
	}

	public Double getPriceFactor() {
		return priceFactor;
	}

	public void setPriceFactor(Double priceFactor) {
		this.priceFactor = priceFactor;
	}

	public User getRecUser() {
		return recUser;
	}

	public void setRecUser(User recUser) {
		this.recUser = recUser;
	}

	public String getSeq() {
		return seq;
	}

	public void setSeq(String seq) {
		this.seq = seq;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public String getQQ() {
		return QQ;
	}

	public void setQQ(String qQ) {
		QQ = qQ;
	}

	public String getSessionID() {
		return sessionID;
	}

	public void setSessionID(String sessionID) {
		this.sessionID = sessionID;
	}

	public Department getDepartment() {
		return department;
	}

	public void setDepartment(Department department) {
		this.department = department;
	}

	public String getOgSessionId() {
		return ogSessionId;
	}

	public void setOgSessionId(String ogSessionId) {
		this.ogSessionId = ogSessionId;
	}
	
	
}
